<!DOCTYPE html>
<html lang="en">
<head>
    <#import "../common/common.macro.ftl" as netCommon>
	<@netCommon.commonStyle />
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <!-- header -->
	<@netCommon.commonHeader />
    <!-- left -->
	<@netCommon.commonLeft "manage" "openapi" />

    <div class="content-wrapper">

        <section class="content-header">

        </section>

        <section class="content">
            <#if apis?exists >
                <div class="row">
                    <div class="col-xs-12">
                        <div class="box">
                            <div class="box-header">
                                <div class="col-sm-2">
                                    <button type="button" class="btn btn-block btn-primary" onclick="toAddOpenApi()">新增授权</button>
                                </div>
                            </div>
                            <!-- /.box-header -->
                            <div class="box-body">
                                <table id="dataList" class="table table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <th>APP ID</th>
                                        <th>应用名</th>
                                        <th>秘钥</th>
                                        <th>状态</th>
                                        <th>备注</th>
                                        <th>创建时间</th>
                                        <th>更新时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <#list apis as item>
                                    <tr id="${item.id}">
                                        <td>${item.appId!''}</td>
                                        <td>${item.appName!''}</td>
                                        <td>${item.appKey!''}</td>
                                        <td>
                                            <#if item.status == "Start">启用</#if>
                                            <#if item.status == "Stop">停用</#if>
                                        </td>
                                        <td>${item.remark!''}</td>
                                        <td>${item.createTime?string('yyyy-MM-dd HH:mm:ss')}</td>
                                        <td>${item.updateTime?string('yyyy-MM-dd HH:mm:ss')}</td>
                                        <td>
                                            <div class="col-sm-4">
                                            <#if item.status == "Stop">
                                                <button type="button" class="btn btn-block btn-xs btn-primary" onclick="changeStatus('${item.id}',this)">启用</button>
                                            </#if>
                                            <#if item.status == "Start">
                                                <button type="button" class="btn btn-block btn-xs btn-danger" onclick="changeStatus('${item.id}',this)">停用</button>
                                            </#if>
                                            </div>
                                            <div class="col-md-4">
                                                <button onclick="toUpdateApi('${item.id}')" type="button" class="btn btn-block btn-warning btn-xs">编辑</button>
                                            </div>
                                            <div class="col-md-4">
                                                <button onclick="deleteApi('${item.id}')" type="button" class="btn btn-block btn-danger btn-xs">删除</button>
                                            </div>
                                        </td>
                                    </tr>
                                    </#list>
                                    </tbody>
                                </table>
                            </div>
                            <!-- /.box-body -->
                        </div>
                        <!-- /.box -->
                    </div>
                </div>
            </#if>
        </section>
    </div>
        <!-- Main content -->
</div>

<@netCommon.commonScript />
<script src="${request.contextPath}/static/js/manage.js"></script>
</body>
</html>